#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <math.h>


int main ()
{

	struct gameState g;
	int players = 2;
	int k[10] = {adventurer, council_room, sea_hag, gardens, mine, remodel, smithy, village, baron, great_hall};
	int seed = 100;
	int res, player, coins;
	int bonus = 0;
	
	//initialize game
	res = initializeGame(players, k, seed, &g);
	player = whoseTurn(&g);
	coins = g.coins;
	//give the second player a copper as their first card.
	printf("g.hand[2][1] = %d\n", g.hand[2][1]);
	g.hand[2][1] = copper;
	printf("copper = %d\n", copper);
	printf("g.hand[2][1] = %d\n", g.hand[2][1]);
	printf("\n~~~~~~~~~~TESTING CUTPURSE~~~~~~~~~~\n");

	res = gainCard(cutpurse, &g, 2, player);
	
	printf("\nCUTPURSE NOT PLAYED\n");
	printf("Current hand size = %d\n", numHandCards(&g));
	printf("Current gold = %d\n", coins);
	printf("Assert other player has a copper in hand...\n");
	printf("...\n...\n...\n");
	assert(g.hand[2][1] == copper);
	printf("Assert passed! Other player now has a copper in hand.\n");
	
	printf("\nCUTPURSE PLAYED\n");

	res = cardEffect(cutpurse, 0, 0, 0, &g, 5, &bonus);

	printf("Expect 4 cards in hand since we just played a card\n");
	printf("# of cards in hand = %d\n", numHandCards(&g));
	assert(numHandCards(&g) == 4);
	
	coins = coins + 2;
	printf("Expect %d gold because Cutpurse adds 2 the current amount\n", coins);
	printf("# of gold = %d\n",  g.coins);
	assert(coins == g.coins);
	
	printf("We should also expect that the copper manually placed should be gone\n");
	printf("So we will assert that the card is NOT a copper. If it fails, then the code has broken here.\n");
	assert(g.hand[2][1] =! copper);
	
	return 0;
	
}
	